using System;
using System.Data;
using System.Linq;
using System.ComponentModel;
using System.Reflection;
using System.Collections.Generic;
using VSSAHT.Transfer;
using VSS_AHT.DataAccess;


namespace VSSAHT.DataAccess
{
	public partial class CustomerMapper
	{
		#region ToEntity

		public static Customer ToEntity(Customer entity, CustomerDTO businessobject)
		{
			if (businessobject == null)
			{
				return null;
			}
			entity.CustomerCode = businessobject.CustomerCode;
			entity.CustomerID = businessobject.CustomerID;
			entity.CustomerName = businessobject.CustomerName;
            entity.RowVersion = VersionConverter.ToBinary(businessobject.RowVersion);
			return entity;
		}

		#endregion

		#region ToBusinessObject

		public static CustomerDTO ToBusinessObject(Customer entity)
		{
			if (entity == null)
			{
				return null;
			}
			return new CustomerDTO
			{
				CustomerCode = entity.CustomerCode,
				CustomerID = entity.CustomerID,
				CustomerName = entity.CustomerName,
                RowVersion = VersionConverter.ToString(entity.RowVersion)
			};
		}

		#endregion

		#region ToBusinessObjectHasChildren

		public static CustomerDTO ToBusinessObjectHasChildren(Customer entity, params Type[] types)
		{
			if (entity == null)
			{
				return null;
			}
			CustomerDTO businessobject = new CustomerDTO
			{
				CustomerCode = entity.CustomerCode,
				CustomerID = entity.CustomerID,
				CustomerName = entity.CustomerName,
				RowVersion = VersionConverter.ToString(entity.RowVersion)
			};
			return businessobject;
		}

		#endregion

	}
}
